﻿#pragma once
#include "users.h"
#include "train_schedule.h"
#include "stations.h"
#include "seats.h"
#include "orders.h"
#include "SeatOccupy.h"
#include <deque>
#include <trains.h>
#include <string>
class AllData
{
public:
	int User_ReadFromFile(const char filename[]);
	int User_WriteToFile(const char filename[]);
	
	int Train_Schedeles_ReadFromFile(const char filename[]);
	int Train_Schedeles_WriteToFile(const char filename[]);

	int Station_ReadFromFile(const char filename[]);
	int Station_WriteToFile(const char filename[]);


	int Seat_ReadFromFile(const char filename[]);
	int Seat_WriteToFile(const char filename[]);

	int Order_ReadFromFile(const char filename[]);
	int Order_WriteToFile(const char filename[]);

	int Train_ReadFromFile(const char filename[]);
	int Train_WriteToFile(const char filename[]);

	int SeatOccupy_ReadFromFile(const char filename[]);
	int SeatOccupy_WriteToFile(const char filename[]);
public:
	std::deque<users> usersQueue; // 存储用户信息的队列
	std::deque<train_schedule> trainSchedules; // 存储火车时刻表的队列
	std::deque<stations> stationsQueue; // 存储车站信息的队列
	std::deque<seats> seatsQueue; // 存储座位信息的队列
	std::deque<orders> ordersQueue; // 存储订单信息的队列
	std::deque<trains> trainQueue;//存储列车信息
	std::deque<SeatOccupy> seatOccupyQueue; // 新增：存储座位占用信息
public:
    // 票价计算：seatType为"商务座"/"一等座"/"二等座"
    double static CalculateTicketPrice(int startStationId, int endStationId, const std::string& seatType, const std::deque<stations>& stationsQueue);
    bool IsSeatAvailable(const std::string& date, int train_id, int seat_id, int start_station_id, int end_station_id);
};

